﻿using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Linq;

namespace config2
{
    public class TestController
    {
        private readonly IOptionsSnapshot<Config> optionsSnapshotConfig;

        public TestController(IOptionsSnapshot<Config> optionsSnapshotConfig)
        {
            this.optionsSnapshotConfig = optionsSnapshotConfig;
        }

        public void test()
        {
            Console.WriteLine("Config节点：");
            Console.WriteLine(this.optionsSnapshotConfig.Value.database);
            Console.WriteLine("=======================================");
            Console.WriteLine(this.optionsSnapshotConfig.Value.password);
            Console.WriteLine("=======================================");
            Console.WriteLine(string.Join(',', this.optionsSnapshotConfig.Value.ids));
            Console.WriteLine("=======================================");
        }
    }
}
